﻿
namespace LS.Nc6.Application.Cms
{
    /// <summary>
    /// 内容表
    /// </summary>
    public interface ICmsContentService : IBaseInterface<CmsContentEntity> {

        /// <summary>
        /// 获取一个对象
        /// </summary>
        /// <param name="expression"></param>
        /// <returns></returns>
        Task<CmsContentEntity> GetModelAsync(Expression<Func<CmsContentEntity, bool>> expression);


      Task<CmsContentEntity> GetFirstModelAsync(Expression<Func<CmsContentEntity, bool>> expression, Expression<Func<CmsContentEntity, object>> expressionOrder, bool orderdesc);

        /// <summary>
        /// 根据栏目Id获取内容集合
        /// </summary>
        /// <param name="channelId"></param>
        /// <returns></returns>
        Task<List<long>> GetContentIdsAsync(long channelId);

        /// <summary>
        /// 获取内容List
        /// </summary>
        /// <param name="expression"></param>
        /// <param name="page"></param>
        /// <param name="limit"></param>
        /// <param name="expressionOrder"></param>
        /// <param name="expressionSelect"></param>
        /// <returns></returns>
        Task<Tuple<List<dynamic>, int, int>> PageDynamicLeftJoinList(Expression<Func<CmsContentEntity, CmsChannelEntity, bool>> expression, int page, int limit,
             Expression<Func<CmsContentEntity, CmsChannelEntity, object>> expressionOrder, Expression<Func<CmsContentEntity, CmsChannelEntity, dynamic>> expressionSelect);

        /// <summary>
        /// 设置内容属性
        /// </summary>
        /// <param name="id"></param>
        /// <param name="top"></param>
        /// <param name="recommend"></param>
        /// <param name="hot"></param>
        /// <param name="color"></param>
        /// <param name="attrType">1=设置 0=取消</param>
        /// <returns></returns>
        Task<int> SetAttr(long id,int top,int recommend,int hot,int color,int attrType);

        /// <summary>
        /// 设置内容排序上升
        /// </summary>
        /// <param name="channelId"></param>
        /// <param name="contentId"></param>
        /// <param name="isTop"></param>
        /// <returns></returns>
        Task<int> SetTaxisToUp(long channelId,long contentId,int isTop);

        /// <summary>
        /// 设置内容排序下降
        /// </summary>
        /// <param name="channelId"></param>
        /// <param name="contentId"></param>
        /// <param name="isTop"></param>
        /// <returns></returns>
        Task<int> SetTaxisToDown(long channelId, long contentId, int isTop);

        /// <summary>
        /// 整理内容排序
        /// </summary>
        /// <param name="channelId"></param>
        /// <param name="attributeName"></param>
        /// <param name="IsDesc"></param>
        /// <returns></returns>
        Task<int> SetArrangeTaxis(long channelId,string attributeName,int IsDesc);

        /// <summary>
        /// 修改浏览次数
        /// </summary>
        /// <param name="contentId"></param>
        /// <param name="hits"></param>
        /// <param name="isAdd"></param>
        /// <returns></returns>
        Task<int> SetHits(long contentId, int hits, int isAdd);

        /// <summary>
        /// 获取栏目下内容最大排序数
        /// </summary>
        /// <param name="channelId"></param>
        /// <returns></returns>
        Task<int> GetTaxis(long channelId);

        /// <summary>
        /// 修改内容状态
        /// </summary>
        /// <param name="contentId"></param>
        /// <param name="state"></param>
        /// <returns></returns>
        Task<int> SetChecked(long contentId,int  state);

    }
}
